<template>
  <div>
    <!-- <tabs :value='value' :data="['全部专业', '适合我的', '已选专业']" @event="bindTabs"></tabs> -->
    <tabs :value='value' :data="['全部专业', '已选专业']" @event="bindTabs"></tabs>
    <!-- 已选的：data.enrollStudentPlans -->
    <major-list ref="majorList"></major-list>
  </div>
</template>
<script type="text/javascript">
// import { api } from '@/utils'
// import _ from 'lodash'
import majorList from '~/components/content/major'
const COMPONENTS = {
  // major
  majorList
}
export default {
  data () {
    return {
      value: '',
      school: '',
      list: '',
      params: {
        page: 0,
        size: 15
      }
    }
  },
  components: COMPONENTS,
  methods: {
    init (data) {
      this.school = data
      this.value = 0
      this.$refs.majorList.init(this.school.collegeId)
    },
    bindTabs (msg) {
      let _type = ['all', 'my', 'select']
      this.value = msg
      this.$refs.majorList.init(this.school.collegeId, _type[msg])
    }
    // getData () {
    //   this.params.collegeId = this.school.collegeId
    //   console.log("111111",this.params)

    //   this.$axios.get(api.queryFirstCollegeMajor, { params: this.params }).then(data => {
    //     if (!_.isEmpty(data)) {
    //       if (data.content.length > 0) {
    //         this.list = data.content

    //         this.totalPages = data.totalPages
    //         this.totalElements = data.totalElements
    //         // 加载状态结束
    //         this.loading = false
    //       } else {
    //         this.text = '暂无数据'
    //       }
    //     } else {
    //       this.text = '暂无数据'
    //       this.list = []
    //       this.totalPages = 0
    //       this.totalElements = 0
    //     }
    //     console.log('整体数据------', this.list)
    //   }).catch(err => {
    //     console.log(err)
    //     this.text = '网络走丢了，请稍后重试！'
    //   })
    // }
  },
  mounted: function () {
    // this.$on('event', function (data) {
    //   this.school = data
    //   this.value = 0
    //   this.$refs.majorList.init(this.school.collegeId)
    // })
  }
}
</script>
<style lang="scss" scoped>
  /deep/ .el-tabs__nav-scroll{
    padding:0 !important;
  }
  /deep/ .block-probability{
    padding-right:40px;
  }
</style>

